<style>

</style>
<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main">
        <div class="order-detail-topbar clearfix">
            <div class="pull-left">
                <span class="order-name m-r5">Auchan (China) investment Co. Ltd</span>
                <span class="order-id color-gray">ID:113334</span>
                <span class="order-id color-gray m-r5">XID:3423423</span>
                <span class="layui-btn layui-btn-xs layui-bg-red m-r5">已签约</span>
                <a href="javascript:history.go(-1);" class="go-back"><i class="fa fa-angle-double-left"></i></a>
            </div>
            <div class="pull-right">
                <button type="button" class="layui-btn layui-btn-xs layui-btn-primary"><i class="fa fa-link"></i> 别名</button>
                <button type="button" class="layui-btn layui-btn-xs layui-btn-primary"><i class="fa fa-star-o"></i> 关注</button>
                <button type="button" class="layui-btn layui-btn-xs layui-btn-primary"><i class="fa fa-search"></i> 企查看</button>
                <button type="button" class="layui-btn layui-btn-xs layui-btn-primary"><i class="fa fa-tag"></i> 新增订单</button>
                <button type="button" class="layui-btn layui-btn-xs layui-btn-primary edit" ><i class="fa fa-pencil"></i> 编辑</button>
                <button type="button" class="layui-btn layui-btn-xs layui-btn-primary remark"><i class="fa fa-comments"></i> 备注</button>
                <button type="button" class="layui-btn layui-btn-xs layui-btn-primary"><i class="fa fa-paperclip"></i> 附件</button>
                <button type="button" class="layui-btn layui-btn-xs layui-btn-primary"><i class="fa fa-th-large"></i> 更多</button>
            </div>
        </div>
        <div class="layui-tab layui-tab-card order-detail-tab" lay-filter="mainTnfoTab">
            <ul class="layui-tab-title">
                <li class="layui-this" lay-id="0">详情</li>
                <li lay-id="1">xx</li>
                <li lay-id="2">xx</li>
                <li lay-id="3">xx</li>
                <li lay-id="4">xx/li>
                <li lay-id="5">xx</li>
                <li lay-id="6">xxx</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show" lay-id="0"></div>
                <div class="layui-tab-item" lay-id="1"></div>
                <div class="layui-tab-item" lay-id="2"></div>
                <div class="layui-tab-item" lay-id="3"></div>
                <div class="layui-tab-item" lay-id="4"></div>
                <div class="layui-tab-item" lay-id="5"></div>
                <div class="layui-tab-item" lay-id="6"></div>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['layer','form', 'table','miniPage','element'], function () {
        var $ = layui.jquery,
            layer = layui.layer,
            form = layui.form,
            table = layui.table,
            miniPage = layui.miniPage,
            element = layui.element;

        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        form.render();

        //默认显示tab
        (function () {
            showInfoTab(0);
        })();

        function showInfoTab(index) {
            //初始的时候显示的内容url
            var initContent = miniPage.getHrefContent('page/project/project_info.html');//此处替换为客户详情页地址
            if (initContent) {
                element.tabChange('mainTnfoTab', index);
                $('[lay-filter="mainTnfoTab"]').find('.layui-tab-item[lay-id='+ index +']').html(initContent);
            }
        }

        element.on('tab(mainTnfoTab)', function(data){
            var $tab = $(data.elem);
            var index = data.index;
            var content = '';
            switch(index) {
                case 0:
                    content = miniPage.getHrefContent('page/customer/info.html');
                    if (content) {
                        $tab.find('.layui-tab-item').eq(index).html(content);
                    }
                    break;
                case 1:
                    content = miniPage.getHrefContent('page/customer/contacts.html');
                    if (content) {
                        $tab.find('.layui-tab-item').eq(index).html(content);
                    }
                    break;
                case 2:
                    content = miniPage.getHrefContent('page/customer/client_project.html');
                    if (content) {
                        $tab.find('.layui-tab-item').eq(index).html(content);
                    }
                    break;
                case 3:
                    content = miniPage.getHrefContent('page/customer/order.html');
                    if (content) {
                        $tab.find('.layui-tab-item').eq(index).html(content);
                    }
                    break;
                case 4:
                    content = miniPage.getHrefContent('page/customer/contract.html');
                    if (content) {
                        $tab.find('.layui-tab-item').eq(index).html(content);
                    }
                    break;
                case 5:
                    content = miniPage.getHrefContent('page/customer/billing.html');
                    if (content) {
                        $tab.find('.layui-tab-item').eq(index).html(content);
                    }
                    break;
                default:
            }

        });

        $(document).on("click", ".edit", function() {
                var content = miniPage.getHrefContent('page/project/edit.html');
                layer.open({
                    title: '编辑项目',
                    area:['80%','80%'],
                    type: 1,
                    shade: 0.2,
                    maxmin:true,
                    shadeClose: true,
                    content: content
                });
        });
    });
</script>